const state = {
  // 需要用2个‘，不能合并
  query: {
    userName: undefined,
    author: undefined,
    deptName: undefined,
  },
  // 选择的时间
  dateRange: [],
  // 选中的栏目ids，不能用str
  channelIds: [],
};
const mutations = {
  SET_QUERY: (state, query) => {
    state.query = query;
  },
  SET_DATEQRANGE: (state, dateRange) => {
    state.dateRange = dateRange;
  },
  SET_CHANNELIDS: (state, channelIds) => {
    state.channelIds = channelIds;
  },
};

const actions = {
  // 查询时调用
  setStaticsQuery({ commit }, query) {
    commit("SET_QUERY", query);
  },

  // 父组件调用
  setChannelIds({ commit }, channelIds) {
    commit("SET_CHANNELIDS", channelIds);
  },

  // 父组件调用
  setDateRange({ commit }, dateRange) {
    commit("SET_DATEQRANGE", dateRange);
  },
};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
